<htmli>
<head>
<title>Connexion SSH</title>
</head>
<body>

<?php
	// Répertoire à afficher
	if(isset($_GET['directory']))
		$dir = $_GET['directory'];
	else
		$dir = '.';
	// Libphenix
	require_once('./core/libphenix.php');
	echo 'connexion<br>';
	// Connection au serveur SSH
	if(($con=lp_ssh_connect('localhost','schaetti','adminpass16--')) < 0)
		exit('echec connexion<br>');
	echo 'execute<br>';
	// Liste le répertoire courant
	$files=lp_ls($con,$dir);
	// Tableau
	echo '<table border="1">';
	echo '<tr><td>Fichier</td><td>Droits</td><td>Proprietaire</td><td>Type</td></tr>';
	foreach($files as $file)
	{
		echo '<tr>';
		if($file->type == IS_FILE)
			echo '<td>'.$file->filename.'</td>';
		else
		{
			echo '<td>';
			echo '<a href="'.$_SERVER['PHP_SELF'].'?directory='.$dir.'/'.$file->filename.'">';
			echo $file->filename;
			echo '</a></td>';
		}
		echo '<td>'.$file->rights.'</td>';
		echo '<td>'.$file->owner.'</td>';
		echo '<td>'.$file->type.'</td>';
		echo '</tr>';
	}
	echo '</table>';
	// Fermeture
	lp_ssh_close($con);

?>

</body>
</html>
